home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1993 / Internet Info CD-ROM (Walnut Creek) (1993).iso / networking / ip / dns / bind / 4.9+SA.diff < prev    next >
Encoding:
Text File  |  1993-07-08  |  37.9 KB  |  1,251 lines

  1. diff -c -r bind4.9.orig/CHANGES bind4.9/CHANGES
  2. *** bind4.9.orig/CHANGES    Sun May  2 20:16:48 1993
  3. --- bind4.9/CHANGES    Fri May 21 14:32:27 1993
  4. ***************
  5. *** 1,3 ****
  6. --- 1,28 ----
  7. + 4.9.1-UMICH -------------------
  8. + This patch fixs a bug in the resolver library, and adds two new RR types:
  9. + AFSDB and SA.
  10. + The resolver bug is one in res_debug.c that is exercised by large queries
  11. + (i.e., queries that will end up using TCP instead of UDP).
  12. + AFSDB records are used to list AFS cell databases.  The RR is defined in 
  13. + RFC 1183.
  14. + SA records are "shuffle address" records, and are not at all standard.  They
  15. + are an option (see OPTIONS and conf/options.h) which allows one to use a new
  16. + type of A record which is randomized (shuffled) before being returned.  We
  17. + use them at the University of Michigan for domain names like hermes.merit.edu
  18. + and msdos.archive.umich.edu.
  19. + Also, the query program in the umich part of the contrib directory needed a
  20. + small change to work with the new BIND 4.9 resolver library.
  21. + And finally, this patch adds a feature called TRY_AS_IS which causes the
  22. + resolver library to try a given name 'as is' if it contains two or more
  23. + dots before tacking on any domain names.  We have found that this 
  24. + drastically reduces the number of local domain packets.
  25.   4.9-FINAL -------------------
  26.   
  27.   Kevin Dunlap sent in some changes for the BOG.  So did a lot of other folks.
  28. diff -c -r bind4.9.orig/OPTIONS bind4.9/OPTIONS
  29. *** bind4.9.orig/OPTIONS    Sun May  2 20:16:49 1993
  30. --- bind4.9/OPTIONS    Fri Jun 18 14:02:11 1993
  31. ***************
  32. *** 209,214 ****
  33. --- 209,235 ----
  34.   and you are interested in a more predictable and sensible interpretation of
  35.   dotted numbers, then you probably want this.
  36.   
  37. + SHUFFLE_ADDRS (origin: Bryan Beecher of UMich)
  38. +     if set, allows the use of shuffle address (SA) records.  these are
  39. + one method for "DNS load balancing" since groups of these records are
  40. + shuffled (randomized) before being returned.  these are currently in use
  41. + at the University of Michigan for names like msdos.archive.umich.edu.
  42. +     you probably want this since the added code is minimal, and it will
  43. + allow you to use SA records if you decide you want to one day.
  44. + TRY_AS_IS (origin: Bryan Beecher of UMich)
  45. +     if set, the resolver library will try a name 'as is'  -- if it contains
  46. + two or more dots -- before trying the name by appending any domains.  This is
  47. + something that we have used for a long time, and it really seems to cut down
  48. + on the number of local domain packets.
  49. +     you probably want this
  50. + LAME_DELEGATION (origin: Don Lewis of Harris)
  51. +     if set, logs lame delegations.  A lame delegation is a case when a
  52. + nameserver is listed as authoritative for a domain (via a NS record), yet
  53. + when queried on names within that domain, it returns non-authoritative data.
  54. +     you might want this if you want to harrass "lamers"
  55.   ## ++Copyright++ 1989
  56.   ## -
  57.   ## Copyright (c) 1989 Regents of the University of California.
  58. diff -c -r bind4.9.orig/TODO bind4.9/TODO
  59. *** bind4.9.orig/TODO    Mon May 17 06:00:10 1993
  60. --- bind4.9/TODO    Fri May 21 14:13:37 1993
  61. ***************
  62. *** 86,116 ****
  63.       (dropping the TTL down low as a "<[date]" approaches,
  64.       and forcing a new zone transfer at "date").
  65.   
  66. - [Paul:  I know you said that you'd like to wait for the IETF DNS WG to "bless"
  67. - an official load balancing scheme, but I'll be adding my shuffle A records to
  68. - BIND 4.9 for use here at U-M anyhow.  The code mods to existing source files
  69. - are minimal since the bulk of the work is done in a separate .c I added.
  70. - If you don't want SA records to move into 4.9.1 unless they become official,
  71. - please just toss this first entry. --bryan@umich.edu]
  72. - [bryan@umich.edu 25apr93]: add "shuffle A" records
  73. -     There are several schemes for adding some kind of load balancing
  74. -     capability to the DNS.  Our "Shuffle Address" (SA) records are one
  75. -     stab at this, and since they're in use at U-M, I need to add them
  76. -     so we can use BIND 4.9 here.
  77. - [bryan@umich.edu 25apr93]: add AFSDB records
  78. -     AFSDB records were proposed in RFC xxxx.  We use them here at the
  79. -     University of Michigan, so I need to add them for our copy of
  80. -     BIND 4.9.
  81. - [bryan@umich.edu 25apr93]: small fix to resolver's p_cdname()
  82. -     The current copy of p_cdname() in the resolver does not work
  83. -     for query responses larger than 512 bytes (which can happen when
  84. -     using TCP).  A very small modification changes the "sanity check"
  85. -     argument (the second one) to dn_expand() from "msg + 512" to
  86. -     "cp + MAXCDNAME".  (This showed up very recently.)
  87.   [gshapiro@wpi.wpi.edu and vixie@pa.dec.com 26apr93]: access control
  88.       "xfrnets" is ok but what we really need is full access control per
  89.       zone rather than a global list of acceptable client nets.  this is
  90. --- 86,91 ----
  91. Common subdirectories: bind4.9.orig/bin and bind4.9/bin
  92. Common subdirectories: bind4.9.orig/conf and bind4.9/conf
  93. Common subdirectories: bind4.9.orig/contrib and bind4.9/contrib
  94. Common subdirectories: bind4.9.orig/doc and bind4.9/doc
  95. Common subdirectories: bind4.9.orig/include and bind4.9/include
  96. Common subdirectories: bind4.9.orig/man and bind4.9/man
  97. Common subdirectories: bind4.9.orig/master and bind4.9/master
  98. Common subdirectories: bind4.9.orig/named and bind4.9/named
  99. Only in bind4.9: native.b
  100. Common subdirectories: bind4.9.orig/res and bind4.9/res
  101. Common subdirectories: bind4.9.orig/tools and bind4.9/tools
  102. diff -c -r bind4.9.orig/conf/options.h bind4.9/conf/options.h
  103. *** bind4.9.orig/conf/options.h    Sun May  2 19:17:42 1993
  104. --- bind4.9/conf/options.h    Wed Jun 16 15:28:19 1993
  105. ***************
  106. *** 92,97 ****
  107. --- 92,100 ----
  108.   #define WANT_PIDFILE    /* if you want the named.pid file (ucb/arc) */
  109.   #define DOTTED_SERIAL    /* if you want to be able to specify dotted serial#s */
  110.   /*#define SENSIBLE_DOTS    /* if you want dotted serial#s to make numeric sense */
  111. + #define SHUFFLE_ADDRS    /* if you want to use shuffle address records (bb) */
  112. + #define TRY_AS_IS    /* try names 'as is' if they have 2+ dots (bb) */
  113. + #define LAME_DELEGATION /* log detected lame delegations (bb) */
  114.   
  115.   /*--------------------------------------------*
  116.    * no user-servicable parts beyond this point *
  117. Common subdirectories: bind4.9.orig/contrib/ckdns and bind4.9/contrib/ckdns
  118. Common subdirectories: bind4.9.orig/contrib/decwrl and bind4.9/contrib/decwrl
  119. Common subdirectories: bind4.9.orig/contrib/dnsparse and bind4.9/contrib/dnsparse
  120. Common subdirectories: bind4.9.orig/contrib/doc-2.0 and bind4.9/contrib/doc-2.0
  121. Common subdirectories: bind4.9.orig/contrib/host and bind4.9/contrib/host
  122. Common subdirectories: bind4.9.orig/contrib/hostmaint and bind4.9/contrib/hostmaint
  123. Common subdirectories: bind4.9.orig/contrib/misc and bind4.9/contrib/misc
  124. Common subdirectories: bind4.9.orig/contrib/named-lint and bind4.9/contrib/named-lint
  125. Common subdirectories: bind4.9.orig/contrib/ninit and bind4.9/contrib/ninit
  126. Common subdirectories: bind4.9.orig/contrib/nutshell and bind4.9/contrib/nutshell
  127. Common subdirectories: bind4.9.orig/contrib/tic and bind4.9/contrib/tic
  128. Common subdirectories: bind4.9.orig/contrib/ucsd and bind4.9/contrib/ucsd
  129. Common subdirectories: bind4.9.orig/contrib/umich and bind4.9/contrib/umich
  130. Common subdirectories: bind4.9.orig/contrib/tic/etc.named and bind4.9/contrib/tic/etc.named
  131. diff -c -r bind4.9.orig/contrib/umich/dnsstats bind4.9/contrib/umich/dnsstats
  132. *** bind4.9.orig/contrib/umich/dnsstats    Mon Apr 26 04:22:06 1993
  133. --- bind4.9/contrib/umich/dnsstats    Thu Jul  8 14:30:38 1993
  134. ***************
  135. *** 13,29 ****
  136.   #
  137.   #  DNS Statistics gatherer
  138.   #  Author:  Bryan Beecher
  139. ! #  Last Modified:   3/10/93
  140.   #
  141. ! #  To make use of this software, you need to be running the
  142. ! #  University of Michigan release of BIND 4.8.3.  This script
  143. ! #  may be used with standard BIND 4.8.3 or 4.8 if the ns_req()
  144. ! #  function is modified to log the IP address of the originator
  145. ! #  of each query, the domain name of the query, and the query
  146. ! #  type.
  147.   #
  148. - #  BIND 4.9 can also use this by turning on the QRYLOG option.
  149. - #
  150.   #  The assumption behind this script is that it will be run out
  151.   #  of crontab daily just before some sort of syslog manager
  152.   #  copies the current contents of LOGFILE elsewhere before
  153. --- 13,23 ----
  154.   #
  155.   #  DNS Statistics gatherer
  156.   #  Author:  Bryan Beecher
  157. ! #  Last Modified:   7/8/93
  158.   #
  159. ! #  To make use of this software, you need to be running a copy of
  160. ! #  BIND 4.9 compiled with the QRYLOG option defined.
  161.   #
  162.   #  The assumption behind this script is that it will be run out
  163.   #  of crontab daily just before some sort of syslog manager
  164.   #  copies the current contents of LOGFILE elsewhere before
  165. ***************
  166. *** 31,39 ****
  167.   #  a LOGFILE that is not emptied daily, and in this case it
  168.   #  would merely report the cumulative statistics.
  169.   # -------------------------------------------------------------
  170. ! #  handy files
  171.   # -------------------------------------------------------------
  172.   LOGFILE=/var/log/named
  173.   TMPFILE=/usr/tmp/.dnsstats$$
  174.   OUTFILE=/usr/tmp/.dnsout$$
  175.   ADDRFILE=/usr/tmp/.addrs$$
  176. --- 25,70 ----
  177.   #  a LOGFILE that is not emptied daily, and in this case it
  178.   #  would merely report the cumulative statistics.
  179.   # -------------------------------------------------------------
  180.   # -------------------------------------------------------------
  181. + #  C O N F I G U R A T I O N    S E C T I O N
  182. + # -------------------------------------------------------------
  183. + ##
  184. + ##  NOTE:  Ultrix users may want to change the first line
  185. + ##         of this script from /bin/sh to /bin/sh5.
  186. + ##
  187. + # -------------------------------------------------------------
  188. + #  Do we use 'getopts' or 'getopt'?
  189. + # -------------------------------------------------------------
  190. + GETOPT=getopts
  191. + # -------------------------------------------------------------
  192. + #  This is the name of the log.
  193. + # -------------------------------------------------------------
  194.   LOGFILE=/var/log/named
  195. + # -------------------------------------------------------------
  196. + #  This is the program we use to look things up.
  197. + # -------------------------------------------------------------
  198. + # QUERYPROG="/usr/local/bin/query -t PTR"
  199. + # QUERYOPTIONS=""
  200. + QUERYPROG="/usr/local/bin/dig"
  201. + QUERYOPTIONS="PTR"
  202. + # -------------------------------------------------------------
  203. + #  This is the awk we use.
  204. + # -------------------------------------------------------------
  205. + AWK=/bin/awk
  206. + # -------------------------------------------------------------
  207. + #  E N D    O F    C O N F I G U R A T I O N    S E C T I O N
  208. + # -------------------------------------------------------------
  209. + # -------------------------------------------------------------
  210. + #  handy files
  211. + # -------------------------------------------------------------
  212.   TMPFILE=/usr/tmp/.dnsstats$$
  213.   OUTFILE=/usr/tmp/.dnsout$$
  214.   ADDRFILE=/usr/tmp/.addrs$$
  215. ***************
  216. *** 74,99 ****
  217.   
  218.   trap "rm -f $TMPFILE $OUTFILE $ADDRFILE $NAMEFILE $TYPEFILE $WEEKFILE ; exit 0" 0 1 2 3 15
  219.   
  220. ! while getopts ac:d:f:nw ARG ; do
  221. !     case $ARG in
  222. !         a)    PRINTALL=1
  223. !             ;;
  224. !         c)    STOPAT=$OPTARG
  225. !             ;;
  226. !         d)     LOGFILE=$LOGFILE"."$OPTARG
  227. !             ;;
  228. !         f)    LOGFILE=$OPTARG
  229. !             ;;
  230. !         n)    NONAMES=1
  231. !             ;;
  232. !         w)    cat $LOGFILE* > $WEEKFILE
  233. !             LOGFILE=$WEEKFILE
  234. !             ;;
  235.   
  236. !     esac
  237. ! done
  238. ! shift `expr $OPTIND - 1`
  239.   
  240.   # -------------------------------------------------------------
  241.   #  divide the log file into three files:
  242.   #    one for source addrs of incoming querys
  243. --- 105,181 ----
  244.   
  245.   trap "rm -f $TMPFILE $OUTFILE $ADDRFILE $NAMEFILE $TYPEFILE $WEEKFILE ; exit 0" 0 1 2 3 15
  246.   
  247. ! gethostbyaddr() {
  248. !     QUERYNAME=`echo $ADDRESS | $AWK  '{ n = split($1, oct, ".")
  249. !       printf("%s.%s.%s.%s.in-addr.arpa.\n", oct[4], oct[3], oct[2], oct[1])
  250. !       }'`
  251. !     $QUERYPROG $QUERYNAME $QUERYOPTIONS 2>&1 | $AWK ' BEGIN {
  252. !         msg = " ** Query failed ** "
  253. !         }
  254. !         {
  255. !         if ($4 == "PTR")
  256. !         msg = substr($5, 1, length($5) - 1)
  257. !         else if ($3 == "PTR")
  258. !         msg = substr($4, 1, length($4) - 1)
  259. !         }
  260. !         END {
  261. !         printf(" %6d  %-39s [%s]\n", count, msg, address)
  262. !         }' count=$COUNT address=$ADDRESS - ;
  263. ! }
  264.   
  265. ! if [ $GETOPT = "getopts" ] ; then
  266. !     while getopts ac:d:f:nw ARG ; do
  267. !         case $ARG in
  268. !             a)    PRINTALL=1
  269. !                 ;;
  270. !             c)    STOPAT=$OPTARG
  271. !                 ;;
  272. !             d)     LOGFILE=$LOGFILE"."$OPTARG
  273. !                 ;;
  274. !             f)    LOGFILE=$OPTARG
  275. !                 ;;
  276. !             n)    NONAMES=1
  277. !                 ;;
  278. !             w)    cat $LOGFILE* > $WEEKFILE
  279. !                 LOGFILE=$WEEKFILE
  280. !                 ;;
  281.   
  282. +         esac
  283. +     done
  284. +     shift `expr $OPTIND - 1`
  285. + else
  286. +     set -- `getopt ac:d:f:nw $*`
  287. +     if [ $? != 0 ] ; then
  288. +         exit 2
  289. +     fi
  290. +     for ARG in $* ; do
  291. +         case $ARG in
  292. +             -a)    PRINTALL=1
  293. +                 shift
  294. +                 ;;
  295. +             -c)    STOPAT=$2
  296. +                 shift 2
  297. +                 ;;
  298. +             -d)     LOGFILE=$LOGFILE"."$2
  299. +                 shift 2
  300. +                 ;;
  301. +             -f)    LOGFILE=$2
  302. +                 shift 2
  303. +                 ;;
  304. +             -n)    NONAMES=1
  305. +                 shift
  306. +                 ;;
  307. +             -w)    cat $LOGFILE* > $WEEKFILE
  308. +                 LOGFILE=$WEEKFILE
  309. +                 shift
  310. +                 ;;
  311. +             --)    shift
  312. +                 break
  313. +                 ;;
  314. +         esac
  315. +     done
  316. + fi
  317.   # -------------------------------------------------------------
  318.   #  divide the log file into three files:
  319.   #    one for source addrs of incoming querys
  320. ***************
  321. *** 100,106 ****
  322.   #    one for domain names that were queried upon
  323.   #    one for query types
  324.   # -------------------------------------------------------------
  325. ! awk '
  326.   {
  327.       if ((n == 0) && ($5 == "last"))
  328.           next
  329. --- 182,188 ----
  330.   #    one for domain names that were queried upon
  331.   #    one for query types
  332.   # -------------------------------------------------------------
  333. ! $AWK '
  334.   {
  335.       if ((n == 0) && ($5 == "last"))
  336.           next
  337. ***************
  338. *** 124,131 ****
  339.   # -------------------------------------------------------------
  340.   #  Print some general information
  341.   # -------------------------------------------------------------
  342. ! echo "DNS stats for" `hostname` "for period ending" `ls -l $LOGFILE | awk '{ print $5, $6, $7 }'`
  343. ! echo "Total queries received: " `wc -l $ADDRFILE | awk '{ print $1}'`
  344.   echo
  345.   echo "Part I -- query sources"
  346.   echo
  347. --- 206,213 ----
  348.   # -------------------------------------------------------------
  349.   #  Print some general information
  350.   # -------------------------------------------------------------
  351. ! echo "DNS stats for" `hostname` "for period ending" `ls -l $LOGFILE | $AWK '{ print $5, $6, $7 }'`
  352. ! echo "Total queries received: " `wc -l $ADDRFILE | $AWK '{ print $1}'`
  353.   echo
  354.   echo "Part I -- query sources"
  355.   echo
  356. ***************
  357. *** 147,160 ****
  358.           if [ $? -ne 0 ] ; then
  359.               break
  360.           fi
  361. !         host $ADDRESS 2>&1 | awk '{
  362. !             if (NF == 1)
  363. !                 printf(" %6d  %-39s [%s]\n", count, $1, address)
  364. !             else {
  365. !                 i = split($0, msg, ":")
  366. !                 printf(" %6d  ** %-33s ** [%s]\n", count, msg[2], address)
  367. !             }
  368. !         }' count=$COUNT address=$ADDRESS -
  369.       done < $ADDRFILE
  370.   else
  371.       echo " Number  IP address"
  372. --- 229,235 ----
  373.           if [ $? -ne 0 ] ; then
  374.               break
  375.           fi
  376. !         gethostbyaddr
  377.       done < $ADDRFILE
  378.   else
  379.       echo " Number  IP address"
  380. ***************
  381. *** 161,169 ****
  382.       echo " ------  ----------"
  383.       sort $ADDRFILE | uniq -c | sort -n -r > $TMPFILE
  384.       if [ $PRINTALL -eq 1 ] ; then
  385. !         awk '{ printf(" %6d  [%s]\n", $1, $2) }' $TMPFILE
  386.       else
  387. !         head -$STOPAT $TMPFILE | awk '{ printf(" %5d  [%s]\n", $1, $2) }'
  388.       fi
  389.   fi
  390.   
  391. --- 236,244 ----
  392.       echo " ------  ----------"
  393.       sort $ADDRFILE | uniq -c | sort -n -r > $TMPFILE
  394.       if [ $PRINTALL -eq 1 ] ; then
  395. !         $AWK '{ printf(" %6d  [%s]\n", $1, $2) }' $TMPFILE
  396.       else
  397. !         head -$STOPAT $TMPFILE | $AWK '{ printf(" %5d  [%s]\n", $1, $2) }'
  398.       fi
  399.   fi
  400.   
  401. ***************
  402. *** 177,185 ****
  403.   echo " ------  ------------"
  404.   sort $NAMEFILE | uniq -c | sort -n -r > $TMPFILE
  405.   if [ $PRINTALL -eq 1 ] ; then
  406. !     awk '{ printf(" %6d  %s\n", $1, $2) }' $TMPFILE
  407.   else
  408. !     head -$STOPAT $TMPFILE | awk '{ printf(" %6d  %s\n", $1, $2) }'
  409.   fi
  410.   
  411.   # -------------------------------------------------------------
  412. --- 252,260 ----
  413.   echo " ------  ------------"
  414.   sort $NAMEFILE | uniq -c | sort -n -r > $TMPFILE
  415.   if [ $PRINTALL -eq 1 ] ; then
  416. !     $AWK '{ printf(" %6d  %s\n", $1, $2) }' $TMPFILE
  417.   else
  418. !     head -$STOPAT $TMPFILE | $AWK '{ printf(" %6d  %s\n", $1, $2) }'
  419.   fi
  420.   
  421.   # -------------------------------------------------------------
  422. ***************
  423. *** 192,200 ****
  424.   echo " ------  ----"
  425.   sort $TYPEFILE | uniq -c | sort -n -r > $TMPFILE
  426.   if [ $PRINTALL -eq 1 ] ; then
  427. !     awk '{ printf(" %6d  %s\n", $1, $2) }' $TMPFILE
  428.   else
  429. !     head -$STOPAT $TMPFILE | awk '{ printf(" %6d  %s\n", $1, $2) }'
  430.   fi
  431.   
  432.   # -------------------------------------------------------------
  433. --- 267,275 ----
  434.   echo " ------  ----"
  435.   sort $TYPEFILE | uniq -c | sort -n -r > $TMPFILE
  436.   if [ $PRINTALL -eq 1 ] ; then
  437. !     $AWK '{ printf(" %6d  %s\n", $1, $2) }' $TMPFILE
  438.   else
  439. !     head -$STOPAT $TMPFILE | $AWK '{ printf(" %6d  %s\n", $1, $2) }'
  440.   fi
  441.   
  442.   # -------------------------------------------------------------
  443. diff -c -r bind4.9.orig/contrib/umich/query.c bind4.9/contrib/umich/query.c
  444. *** bind4.9.orig/contrib/umich/query.c    Mon Apr 26 04:22:17 1993
  445. --- bind4.9/contrib/umich/query.c    Mon May 17 11:37:02 1993
  446. ***************
  447. *** 171,177 ****
  448.           if (res_query(name, class, type, answer, len) < 0) {
  449.               hp = (HEADER *) answer;
  450.               if ((hp->rcode == 0) && (hp->ancount > 0))
  451. !                 p_query(answer);
  452.               else
  453.                   fprintf(stderr, "Query failed (h_errno = %d) : %s\n", 
  454.                           h_errno, h_errlist[h_errno]);
  455. --- 171,177 ----
  456.           if (res_query(name, class, type, answer, len) < 0) {
  457.               hp = (HEADER *) answer;
  458.               if ((hp->rcode == 0) && (hp->ancount > 0))
  459. !                 __p_query(answer);
  460.               else
  461.                   fprintf(stderr, "Query failed (h_errno = %d) : %s\n", 
  462.                           h_errno, h_errlist[h_errno]);
  463. ***************
  464. *** 181,192 ****
  465.       else if (res_search(name, class, type, answer, len) < 0) {
  466.           hp = (HEADER *) answer;
  467.           if ((hp->rcode == 0) && (hp->ancount > 0))
  468. !             p_query(answer);
  469.           else
  470.               fprintf(stderr, "Query failed (h_errno = %d) : %s\n", 
  471.                           h_errno, h_errlist[h_errno]);
  472.           exit(-1);
  473.       }
  474. !     p_query(answer);
  475.       exit(0);
  476.   }
  477. --- 181,192 ----
  478.       else if (res_search(name, class, type, answer, len) < 0) {
  479.           hp = (HEADER *) answer;
  480.           if ((hp->rcode == 0) && (hp->ancount > 0))
  481. !             __p_query(answer);
  482.           else
  483.               fprintf(stderr, "Query failed (h_errno = %d) : %s\n", 
  484.                           h_errno, h_errlist[h_errno]);
  485.           exit(-1);
  486.       }
  487. !     __p_query(answer);
  488.       exit(0);
  489.   }
  490. diff -c -r bind4.9.orig/contrib/umich/zt bind4.9/contrib/umich/zt
  491. *** bind4.9.orig/contrib/umich/zt    Mon Apr 26 04:22:21 1993
  492. --- bind4.9/contrib/umich/zt    Thu Jul  8 14:01:15 1993
  493. ***************
  494. *** 119,129 ****
  495.       #  have run out of subdomains, we're done
  496.       #----------------------------------------------------
  497.       if [ $DONE = 1 ] ; then
  498. !         if [ -s /tmp/zt.out.$$ ] ; then
  499. !             cat /tmp/zt.out.$$
  500. !         else
  501. !             echo "Could not perform a zone transfer of $1"
  502. !         fi
  503.           rm -f /tmp/zt.out.$$
  504.           exit 0
  505.       else
  506. --- 119,125 ----
  507.       #  have run out of subdomains, we're done
  508.       #----------------------------------------------------
  509.       if [ $DONE = 1 ] ; then
  510. !         cat /tmp/zt.out.$$
  511.           rm -f /tmp/zt.out.$$
  512.           exit 0
  513.       else
  514. Common subdirectories: bind4.9.orig/doc/BOG and bind4.9/doc/BOG
  515. diff -c -r bind4.9.orig/doc/BOG/files.me bind4.9/doc/BOG/files.me
  516. *** bind4.9.orig/doc/BOG/files.me    Sun May  2 20:23:56 1993
  517. --- bind4.9/doc/BOG/files.me    Fri May 21 14:09:18 1993
  518. ***************
  519. *** 580,585 ****
  520. --- 580,597 ----
  521.   The \fIAddress\fP record, \fIA\fP, lists the address for a given machine. 
  522.   The name field is the machine name and the address is the network address.
  523.   There should be one \fIA\fP record for each address of the machine. 
  524. + .sh 3 "SA - Shuffle Address"
  525. + .TS
  526. + l l l l l.
  527. + \fI{name}    {ttl}    addr-class    SA    address\fP
  528. + archive        IN    SA    141\fB.\fP211\fB.\fP165\fB.\fP41
  529. +         IN    SA    141\fB.\fP211\fB.\fP32\fB.\fP2
  530. + .TE
  531. + The \fIShuffle Address\fP record, \fISA\fP, lists the address for a given
  532. + machine as above.  Unlike the \fIAddress\fP record, records of this type
  533. + are randomized (shuffled) before being returned.  The records are
  534. + returned as simple \fIAddress\fP records so that client software does not
  535. + need to be modified.
  536.   .sh 3 "HINFO - Host Information"
  537.   .TS
  538.   l l l l l l. 
  539. Common subdirectories: bind4.9.orig/include/arpa and bind4.9/include/arpa
  540. Common subdirectories: bind4.9.orig/include/sys and bind4.9/include/sys
  541. diff -c -r bind4.9.orig/include/arpa/nameser.h bind4.9/include/arpa/nameser.h
  542. *** bind4.9.orig/include/arpa/nameser.h    Mon May 17 06:00:15 1993
  543. --- bind4.9/include/arpa/nameser.h    Mon May 17 15:27:16 1993
  544. ***************
  545. *** 135,145 ****
  546. --- 135,147 ----
  547.   #define T_MX        15        /* mail routing information */
  548.   #define T_TXT        16        /* text strings */
  549.   #define    T_RP        17        /* responsible person */
  550. + #define T_AFSDB        18        /* AFS cell database */
  551.       /* non standard */
  552.   #define T_UINFO        100        /* user (finger) information */
  553.   #define T_UID        101        /* user ID */
  554.   #define T_GID        102        /* group ID */
  555.   #define T_UNSPEC    103        /* Unspecified format (binary data) */
  556. + #define T_SA        104        /* shuffle address */
  557.       /* Query type values which do not appear in resource records */
  558.   #define T_AXFR        252        /* transfer zone of authority */
  559.   #define T_MAILB        253        /* transfer mailbox records */
  560. diff -c -r bind4.9.orig/man/named.8 bind4.9/man/named.8
  561. *** bind4.9.orig/man/named.8    Mon May 17 04:45:57 1993
  562. --- bind4.9/man/named.8    Fri May 21 13:59:45 1993
  563. ***************
  564. *** 98,103 ****
  565. --- 98,110 ----
  566.   .B \-q
  567.   Trace all incoming queries if \fInamed\fP has been compiled with
  568.   \fIQRYLOG\fP defined.
  569. + .TP
  570. + .B \-s
  571. + Use this flag if \fInamed\fP has been compiled with
  572. + \fISHUFFLE_ADDRS\fP defined, and both you and all of your secondary
  573. + nameservers know about SA records.  If this flag is not present,
  574. + and you use SA records, then they are passed on as simple A records
  575. + by the zone transfer program.
  576.   .PP
  577.   Any additional argument is taken as the name of the boot file.
  578.   If multiple boot files are specified, only the last is used.
  579. diff -c -r bind4.9.orig/named/db.h bind4.9/named/db.h
  580. *** bind4.9.orig/named/db.h    Sun May  2 20:24:37 1993
  581. --- bind4.9/named/db.h    Mon May 17 14:55:49 1993
  582. ***************
  583. *** 102,107 ****
  584. --- 102,111 ----
  585.    */
  586.   #define DB_F_HINT       0x01    /* databuf belongs to fcachetab */
  587.   
  588. + #ifdef SHUFFLE_ADDRS
  589. + #define DB_F_SHUFFLE    0x02    /* records should be shuffled */
  590. + #endif
  591.   #ifdef CRED
  592.   /*
  593.    * d_cred definitions
  594. diff -c -r bind4.9.orig/named/db_dump.c bind4.9/named/db_dump.c
  595. *** bind4.9.orig/named/db_dump.c    Sun May  2 20:24:38 1993
  596. --- bind4.9/named/db_dump.c    Mon May 17 11:01:06 1993
  597. ***************
  598. *** 480,485 ****
  599. --- 480,486 ----
  600.                   break;
  601.   
  602.               case T_MX:
  603. +             case T_AFSDB:
  604.                   GETSHORT(n, cp);
  605.                   fprintf(fp,"%lu", n);
  606.                   fprintf(fp," %s.", cp);
  607. diff -c -r bind4.9.orig/named/db_load.c bind4.9/named/db_load.c
  608. *** bind4.9.orig/named/db_load.c    Sun May  2 20:24:39 1993
  609. --- bind4.9/named/db_load.c    Mon May 17 14:58:49 1993
  610. ***************
  611. *** 121,128 ****
  612. --- 121,132 ----
  613.       "uinfo",    T_UINFO,
  614.       "txt",        T_TXT,
  615.       "rp",        T_RP,
  616. +     "afsdb",    T_AFSDB,
  617.       "uid",        T_UID,
  618.       "gid",        T_GID,
  619. + #ifdef SHUFFLE_ADDRS
  620. +     "sa",        T_SA,
  621. + #endif
  622.   #ifdef notdef
  623.       "any",        T_ANY,        /* any is a QTYPE, not TYPE */
  624.   #endif
  625. ***************
  626. *** 334,339 ****
  627. --- 338,349 ----
  628.                * based on the type and pack into 'data'.
  629.                */
  630.               switch (type) {
  631. + #ifdef SHUFFLE_ADDRS
  632. +             case T_SA:
  633. +                 type = T_A;
  634. +                 dataflags |= DB_F_SHUFFLE;
  635. +                 /* now fall through */
  636. + #endif
  637.               case T_A:
  638.                   n = ntohl((u_int32_t)inet_addr((char *)buf));
  639.                   cp = data;
  640. ***************
  641. *** 467,472 ****
  642. --- 477,483 ----
  643.                   n = strlen((char *)data) + 1;
  644.                   break;
  645.               case T_MX:
  646. +             case T_AFSDB:
  647.                   n = 0;
  648.                   cp = buf;
  649.                   while (isdigit(*cp))
  650. ***************
  651. *** 560,565 ****
  652. --- 571,579 ----
  653.                   (u_char *)data, (int)n);
  654.               dp->d_zone = zp - zones;
  655.               dp->d_flags = dataflags;
  656. + #ifdef SHUFFLE_ADDRS
  657. +             dataflags &= ~DB_F_SHUFFLE;
  658. + #endif
  659.   #ifdef CRED
  660.               dp->d_cred = DB_C_AUTH;
  661.   #endif /*CRED*/
  662. diff -c -r bind4.9.orig/named/db_update.c bind4.9/named/db_update.c
  663. *** bind4.9.orig/named/db_update.c    Sun May  2 20:24:41 1993
  664. --- bind4.9/named/db_update.c    Mon May 17 11:02:42 1993
  665. ***************
  666. *** 530,535 ****
  667. --- 530,536 ----
  668.           return bcmp(cp1, cp2, sizeof(u_int32_t) * 5);
  669.       
  670.       case T_MX:
  671. +     case T_AFSDB:
  672.           cp1 = dp1->d_data;
  673.           cp2 = dp2->d_data;
  674.           if (*cp1++ != *cp2++ || *cp1++ != *cp2++)    /* cmp prio */
  675. diff -c -r bind4.9.orig/named/named-xfer.c bind4.9/named/named-xfer.c
  676. *** bind4.9.orig/named/named-xfer.c    Mon May 17 06:01:13 1993
  677. --- bind4.9/named/named-xfer.c    Tue Jul  6 11:12:20 1993
  678. ***************
  679. *** 144,150 ****
  680.           c += (close(fd) == 0);
  681.       }
  682.   #ifdef LOG_DAEMON
  683. !     openlog("named-xfer", LOG_PID|LOG_CONS, LOG_DAEMON);
  684.   #else
  685.       openlog("named-xfer", LOG_PID);
  686.   #endif
  687. --- 144,150 ----
  688.           c += (close(fd) == 0);
  689.       }
  690.   #ifdef LOG_DAEMON
  691. !     openlog("named-xfer", LOG_PID|LOG_CONS, LOG_LOCAL2);
  692.   #else
  693.       openlog("named-xfer", LOG_PID);
  694.   #endif
  695. ***************
  696. *** 986,991 ****
  697. --- 986,994 ----
  698.        * Convert the resource record data into the internal database format.
  699.        */
  700.       switch (type) {
  701. + #ifdef SHUFFLE_ADDRS
  702. +     case T_SA:
  703. + #endif
  704.       case T_A:
  705.       case T_WKS:
  706.       case T_HINFO:
  707. ***************
  708. *** 1046,1051 ****
  709. --- 1049,1055 ----
  710.           break;
  711.   
  712.       case T_MX:
  713. +     case T_AFSDB:
  714.           /* grab preference */
  715.           bcopy((char *) cp, (char *) data, sizeof(u_short));
  716.           cp1 = data + sizeof(u_short);
  717. ***************
  718. *** 1159,1164 ****
  719. --- 1163,1171 ----
  720.        */
  721.       switch (type) {
  722.   
  723. + #ifdef SHUFFLE_ADDRS
  724. +     case T_SA:
  725. + #endif
  726.       case T_A:
  727.           switch (class) {
  728.           case C_IN:
  729. ***************
  730. *** 1223,1228 ****
  731. --- 1230,1236 ----
  732.           break;
  733.   
  734.       case T_MX:
  735. +     case T_AFSDB:
  736.           GETSHORT(n, cp);
  737.           (void) fprintf(dbfp, "%lu", n);
  738.           (void) fprintf(dbfp, " %s.\n", cp);
  739. ***************
  740. *** 1233,1243 ****
  741.           (void) putc('"', dbfp);
  742.           while (cp < cp1) {
  743.               if (i = *cp++) {
  744. !                 for (j = i ; j > 0 && cp < cp1 ; j--)
  745.                       if ((*cp == '\n') || (*cp == '"')) {
  746.                           (void) putc('\\', dbfp);
  747.                       }
  748.                       (void) putc(*cp++, dbfp);
  749.               }
  750.           }
  751.           (void) fputs("\"\n", dbfp);
  752. --- 1241,1252 ----
  753.           (void) putc('"', dbfp);
  754.           while (cp < cp1) {
  755.               if (i = *cp++) {
  756. !                 for (j = i ; j > 0 && cp < cp1 ; j--) {
  757.                       if ((*cp == '\n') || (*cp == '"')) {
  758.                           (void) putc('\\', dbfp);
  759.                       }
  760.                       (void) putc(*cp++, dbfp);
  761. +                 }
  762.               }
  763.           }
  764.           (void) fputs("\"\n", dbfp);
  765. diff -c -r bind4.9.orig/named/ns.h bind4.9/named/ns.h
  766. *** bind4.9.orig/named/ns.h    Sun May  2 20:24:45 1993
  767. --- bind4.9/named/ns.h    Wed Jun 16 11:51:03 1993
  768. ***************
  769. *** 170,175 ****
  770. --- 170,178 ----
  771.       char    *q_cmsg;        /* the cname message */
  772.       struct    qstream *q_stream;    /* TCP stream, null if UDP */
  773.       int    q_system;        /* boolean, system query */
  774. + #ifdef LAME_DELEGATION
  775. +     char    q_domain[MAXDNAME];    /* domain for servers we are querying */
  776. + #endif /* LAME_DELEGATION */
  777.   };
  778.   
  779.   #define    Q_NEXTADDR(qp,n)    \
  780. diff -c -r bind4.9.orig/named/ns_forw.c bind4.9/named/ns_forw.c
  781. *** bind4.9.orig/named/ns_forw.c    Sun May  2 20:24:46 1993
  782. --- bind4.9/named/ns_forw.c    Fri Jun 18 12:03:47 1993
  783. ***************
  784. *** 99,106 ****
  785. --- 99,111 ----
  786.    * dangerous, such as fwd to ourselves or fwd to the host that asked us.
  787.    * (no action is taken on errors and qpp is not filled in.)
  788.    */
  789. + #ifdef LAME_DELEGATION
  790.   int
  791. + ns_forw(nsp, msg, msglen, fp, qsp, dfd, qpp, dname, np)
  792. + #else /* LAME DELEGATION */
  793. + int
  794.   ns_forw(nsp, msg, msglen, fp, qsp, dfd, qpp, dname)
  795. + #endif /* LAME DELEGATION */
  796.       struct databuf *nsp[];
  797.       u_char *msg;
  798.       int msglen;
  799. ***************
  800. *** 109,114 ****
  801. --- 114,122 ----
  802.       int dfd;
  803.       struct qinfo **qpp;
  804.       char *dname;
  805. + #ifdef LAME_DELEGATION
  806. +         struct namebuf *np;
  807. + #endif /* LAME DELEGATION */
  808.   {
  809.       register struct qinfo *qp;
  810.       HEADER *hp;
  811. ***************
  812. *** 143,148 ****
  813. --- 151,159 ----
  814.       }
  815.   
  816.       qp = qnew();
  817. + #ifdef LAME_DELEGATION
  818. +         getname(np, qp->q_domain, sizeof(qp->q_domain));
  819. + #endif /* LAME DELEGATION */
  820.       qp->q_from = *fp;    /* nslookup wants to know this */
  821.       if ((n = nslookup(nsp, qp, dname, "ns_forw")) < 0) {
  822.   #ifdef DEBUG
  823. diff -c -r bind4.9.orig/named/ns_main.c bind4.9/named/ns_main.c
  824. *** bind4.9.orig/named/ns_main.c    Sun May  2 20:24:47 1993
  825. --- bind4.9/named/ns_main.c    Thu Jul  8 14:31:29 1993
  826. ***************
  827. *** 159,164 ****
  828. --- 159,168 ----
  829.   int qrylog = 0;
  830.   #endif /*QRYLOG*/
  831.   
  832. + #ifdef SHUFFLE_ADDRS
  833. + int pass_sa_rrs = 0;
  834. + #endif
  835.   int    priming = 0;            /* is cache being primed */
  836.   
  837.   #ifdef SO_RCVBUF
  838. ***************
  839. *** 316,321 ****
  840. --- 320,330 ----
  841.                   case 'q':
  842.                       qrylog = 1;
  843.                       break;
  844. + #ifdef SHUFFLE_ADDRS
  845. +                 case 's':
  846. +                     pass_sa_rrs = 1;
  847. +                     break;
  848. + #endif
  849.                   default:
  850.                       usage();
  851.                   }
  852. ***************
  853. *** 360,366 ****
  854.   #endif /*WANT_PIDFILE*/
  855.   
  856.       syslog(LOG_NOTICE, "starting");
  857.       _res.options &= ~(RES_DEFNAMES | RES_DNSRCH | RES_RECURSE);
  858.   
  859.       nsaddr.sin_family = AF_INET;
  860. --- 369,374 ----
  861. diff -c -r bind4.9.orig/named/ns_req.c bind4.9/named/ns_req.c
  862. *** bind4.9.orig/named/ns_req.c    Sun May  2 20:24:48 1993
  863. --- bind4.9/named/ns_req.c    Fri Jun 18 12:05:04 1993
  864. ***************
  865. *** 109,114 ****
  866. --- 109,117 ----
  867.   #ifdef XFRNETS
  868.   extern struct netinfo *xfrnets;
  869.   #endif
  870. + #ifdef SHUFFLE_ADDRS
  871. + int found_shuffle;
  872. + #endif
  873.   
  874.   int stale(), make_rr(), doaddinfo(), doaddauth();
  875.   void ns_req(), fwritemsg(), getname(), doaxfr(), startxfr();
  876. ***************
  877. *** 393,398 ****
  878. --- 396,408 ----
  879.                   founddata, cname);
  880.           }
  881.   #endif
  882. + #ifdef SHUFFLE_ADDRS
  883. +         if (found_shuffle) {
  884. +             found_shuffle = 0;
  885. +             shuffle_response(answers, count, cp);
  886. +         }
  887. +         else
  888. + #endif
  889.           if ((lp = local(from)) != NULL) 
  890.               sort_response(answers, count, lp, cp);
  891.           if (type == T_AXFR) {
  892. ***************
  893. *** 492,498 ****
  894. --- 502,512 ----
  895.                   (char *)NULL, 0, NULL, (char *)msg,
  896.                   msglen+buflen);
  897.           }
  898. + #ifdef LAME_DELEGATION
  899. +         n = ns_forw(nsp, msg, msglen, from, qsp, dfd, &qp, dname, np);
  900. + #else /* LAME DELEGATION */
  901.           n = ns_forw(nsp, msg, msglen, from, qsp, dfd, &qp, dname);
  902. + #endif /* LAME DELEGATION */
  903.           if (n != FW_OK && cname)
  904.               free(omsg);
  905.           switch (n) {
  906. ***************
  907. *** 944,949 ****
  908. --- 958,964 ----
  909.           break;
  910.   
  911.       case T_MX:
  912. +     case T_AFSDB:
  913.           /* cp1 == our data/ cp == data of RR */
  914.           cp1 = dp->d_data;
  915.   
  916. ***************
  917. *** 1196,1201 ****
  918. --- 1211,1219 ----
  919.       char dname[MAXDNAME];
  920.       HEADER *hp = (HEADER *) msg;
  921.       int fndns;
  922. + #ifdef SHUFFLE_ADDRS
  923. +     extern int pass_sa_rrs;
  924. + #endif
  925.   
  926.   #ifdef DEBUG
  927.       if (debug && (np == top))
  928. ***************
  929. *** 1277,1282 ****
  930. --- 1295,1307 ----
  931.               continue;
  932.           if (dp->d_zone == 0 || stale(dp))
  933.               continue;
  934. + #ifdef SHUFFLE_ADDRS
  935. +         if ((dp->d_flags & DB_F_SHUFFLE) &&
  936. +            pass_sa_rrs && (dp->d_type == T_A)) {
  937. +             syslog(LOG_INFO, "Found a shuffle record");
  938. +             dp->d_type = T_SA;
  939. +         }
  940. + #endif
  941.           if ((n = make_rr(dname, dp, cp, sizeof(msg)-sizeof(HEADER), 0)) < 0)
  942.               continue;
  943.           fwritemsg(rfp, msg, n + sizeof(HEADER));
  944. ***************
  945. *** 1666,1668 ****
  946. --- 1691,1754 ----
  947.           exit(0);
  948.       }
  949.   }
  950. + #ifdef SHUFFLE_ADDRS
  951. + shuffle_response(cp, count, eom)
  952. + register u_char *cp;
  953. + int count;
  954. + u_char *eom;
  955. + {
  956. + #define ITEMS_TO_SHUFFLE 32 /* arbitrary -- can make it higher */
  957. +     register int i, j, c;
  958. +     int type, class, dlen, n, A_recs = 0;
  959. +     struct in_addr inaddr[ITEMS_TO_SHUFFLE];
  960. +     u_char *rr[ITEMS_TO_SHUFFLE];
  961. + #ifdef DEBUG
  962. +     if (debug > 2) 
  963. +         fprintf(ddt,"shuffle_rrs(0x%x, %d)\n", cp, count);
  964. + #endif DEBUG
  965. +     if (count == 1) 
  966. +         return;        /* nothing to randomize */
  967. +     if (count > ITEMS_TO_SHUFFLE) {
  968. + #ifdef DEBUG
  969. +         if (debug > 2) 
  970. +             fprintf(ddt, "Too many records to shuffle\n");
  971. +         return;
  972. +     }
  973. + #endif DEBUG
  974. +     /* gather up the A records */
  975. +     for (c = count, i = 0; c > 0; --c, i++) {
  976. +         n = dn_skipname(cp, eom);
  977. +         if (n < 0) return;        /* bogus, stop processing */
  978. +             cp += n;
  979. +             if (cp + QFIXEDSZ > eom) return;
  980. +             GETSHORT(type, cp);
  981. +         if (type != T_A)
  982. +             continue;
  983. +             GETSHORT(class, cp);
  984. +             cp += sizeof(u_long);
  985. +             GETSHORT(dlen, cp);
  986. +             if (dlen > eom - cp) return;    /* bogus, stop processing */
  987. +         rr[i] = cp;
  988. +         bcopy(cp, (char *) &(inaddr[i]), sizeof(struct in_addr));
  989. +         cp += dlen;
  990. +         A_recs++;
  991. +     }
  992. +     if (A_recs < 2)
  993. +         return;
  994. +     /* shuffle up the addresses */
  995. +     if ((c = rand() % A_recs) == 0)
  996. +         return;
  997. +     for (i = 0, j = A_recs; j > 0; j--, i++) {
  998. +         bcopy((char *) &(inaddr[c]), rr[i], sizeof(struct in_addr));
  999. +         if (++c == A_recs) 
  1000. +             c = 0;
  1001. +     }
  1002. +     return;
  1003. + }
  1004. + #endif
  1005. diff -c -r bind4.9.orig/named/ns_resp.c bind4.9/named/ns_resp.c
  1006. *** bind4.9.orig/named/ns_resp.c    Sun May  2 20:24:49 1993
  1007. --- bind4.9/named/ns_resp.c    Fri Jun 18 12:01:12 1993
  1008. ***************
  1009. *** 94,99 ****
  1010. --- 94,103 ----
  1011.           wanted(), add_data();
  1012.   struct qinfo    *sysquery();
  1013.   
  1014. + #ifdef SHUFFLE_ADDRS
  1015. + extern int found_shuffle;
  1016. + #endif
  1017.   void
  1018.   ns_resp(msg, msglen)
  1019.       u_char *msg;
  1020. ***************
  1021. *** 172,177 ****
  1022. --- 176,219 ----
  1023.           return;
  1024.       }
  1025.   
  1026. + #ifdef LAME_DELEGATION
  1027. +         /*
  1028. +          *  Non-authoritative, no answer, no error
  1029. +          */
  1030. +         if (hp->rcode == NOERROR && !hp->aa && ntohs(hp->ancount) == 0 &&
  1031. +              ntohs(hp->nscount) > 0) {
  1032. +                 char qname[MAXDNAME];
  1033. +                 cp = msg + sizeof(HEADER);
  1034. +                 dpp = dnptrs;
  1035. +                 *dpp++ = msg;
  1036. +                 if ((*cp & INDIR_MASK) == 0)
  1037. +                         *dpp++ = cp;
  1038. +                 *dpp = NULL;
  1039. +                 if (hp->qdcount) {
  1040. +                         n = dn_expand(msg, msg + msglen, cp, qname, sizeof(qname));
  1041. +                         if (n <= 0)
  1042. +                                 goto formerr;
  1043. +                         cp += n;
  1044. +                         GETSHORT(type, cp);
  1045. +                         GETSHORT(class, cp);
  1046. +                         if (cp - msg > msglen)
  1047. +                                 goto formerr;
  1048. +                 }
  1049. +                 if ((n = dn_expand(msg, msg + msglen, cp, name, sizeof(name))) < 0) {
  1050. +                         goto formerr;
  1051. +                 }
  1052. +                 cp += n;
  1053. +                 GETSHORT(type, cp);
  1054. +                 if ((type == T_NS) && (strlen(name) <= strlen(qp->q_domain)) && (strlen(name) > 0)) {
  1055. +                         syslog(LOG_WARNING, "Lame delegation to '%s' received from %s (purported server for '%s') on query on name [%s]\n",
  1056. +                                 name, inet_ntoa(from_addr.sin_addr),
  1057. +                                 qp->q_domain, qname);
  1058. +                         return;
  1059. +                 }
  1060. +         }
  1061. + #endif /* LAME_DELEGATION */
  1062.   #ifdef ALLOW_UPDATES
  1063.       if ( (hp->rcode == NOERROR) &&
  1064.            (hp->opcode == UPDATEA || hp->opcode == UPDATED ||
  1065. ***************
  1066. *** 718,723 ****
  1067. --- 760,768 ----
  1068.       qp->q_naddr = 0;
  1069.       qp->q_curaddr = 0;
  1070.       qp->q_fwd = fwdtab;
  1071. + #ifdef LAME_DELEGATION
  1072. +         getname(np, qp->q_domain, sizeof(qp->q_domain));
  1073. + #endif /* LAME_DELEGATION */
  1074.       if ((n = nslookup(nsp, qp, dname, "ns_resp")) <= 0) {
  1075.   #ifdef DEBUG
  1076.           if (debug >= 3)
  1077. ***************
  1078. *** 980,985 ****
  1079. --- 1025,1031 ----
  1080.           break;
  1081.   
  1082.       case T_MX:
  1083. +     case T_AFSDB:
  1084.           /* grab preference */
  1085.           bcopy(cp,data,sizeof(u_short));
  1086.           cp1 = data + sizeof(u_short);
  1087. ***************
  1088. *** 1763,1768 ****
  1089. --- 1809,1818 ----
  1090.                   foundstale++;
  1091.               continue;
  1092.           }
  1093. + #ifdef SHUFFLE_ADDRS
  1094. +         if (dp->d_flags & DB_F_SHUFFLE)
  1095. +             found_shuffle = 1;
  1096. + #endif
  1097.           if ((n = make_rr(*dnamep, dp, (u_char *)cp, buflen, 1)) < 0) {
  1098.               hp->tc = 1;
  1099.               *countp = count;
  1100. diff -c -r bind4.9.orig/res/res_debug.c bind4.9/res/res_debug.c
  1101. *** bind4.9.orig/res/res_debug.c    Mon May 17 06:01:21 1993
  1102. --- bind4.9/res/res_debug.c    Mon May 24 11:28:03 1993
  1103. ***************
  1104. *** 65,70 ****
  1105. --- 65,71 ----
  1106.   #include <resolv.h>
  1107.   #include <stdio.h>
  1108.   #include "../conf/portability.h"
  1109. + #include "../conf/options.h"
  1110.   
  1111.   void __fp_query();
  1112.   char *__p_class(), *__p_time(), *__p_type();
  1113. ***************
  1114. *** 348,354 ****
  1115.       char name[MAXDNAME];
  1116.       int n;
  1117.   
  1118. !     if ((n = dn_expand((u_char *)msg, (u_char *)msg + 512, (u_char *)cp,
  1119.           (u_char *)name, sizeof(name))) < 0)
  1120.           return (NULL);
  1121.       if (name[0] == '\0') {
  1122. --- 349,361 ----
  1123.       char name[MAXDNAME];
  1124.       int n;
  1125.   
  1126. !     /*
  1127. !      *  Cannot assume that the message is 512 bytes long.  It could
  1128. !      *  be longer for TCP-based messages.  A better "sanity check"
  1129. !      *  here would be to make sure that cp does not get advanced more
  1130. !      *  than MAXCDNAME (maximum size of a compressed domain name) bytes.
  1131. !      */
  1132. !     if ((n = dn_expand((u_char *)msg, (u_char *)cp + MAXCDNAME, (u_char *)cp,
  1133.           (u_char *)name, sizeof(name))) < 0)
  1134.           return (NULL);
  1135.       if (name[0] == '\0') {
  1136. ***************
  1137. *** 367,373 ****
  1138.       char name[MAXDNAME];
  1139.       int n, len;
  1140.   
  1141. !     if ((n = dn_expand((u_char *)msg, (u_char *)msg + 512, (u_char *)cp,
  1142.           (u_char *)name, sizeof(name))) < 0)
  1143.           return (NULL);
  1144.       if (name[0] == '\0') {
  1145. --- 374,380 ----
  1146.       char name[MAXDNAME];
  1147.       int n, len;
  1148.   
  1149. !     if ((n = dn_expand((u_char *)msg, (u_char *)cp + MAXCDNAME, (u_char *)cp,
  1150.           (u_char *)name, sizeof(name))) < 0)
  1151.           return (NULL);
  1152.       if (name[0] == '\0') {
  1153. ***************
  1154. *** 483,488 ****
  1155. --- 490,496 ----
  1156.           break;
  1157.   
  1158.       case T_MX:
  1159. +     case T_AFSDB:
  1160.           fprintf(file,"\t%d ", _getshort(cp));
  1161.           cp += sizeof(u_short);
  1162.           cp = p_fqname(cp, msg, file);
  1163. ***************
  1164. *** 629,634 ****
  1165. --- 637,644 ----
  1166.           return("TXT");
  1167.       case T_RP:        /* responsible person */
  1168.           return("RP");
  1169. +     case T_AFSDB:        /* AFS cell database */
  1170. +         return("AFSDB");
  1171.       case T_AXFR:        /* zone transfer */
  1172.           return("AXFR");
  1173.       case T_MAILB:        /* mail box */
  1174. ***************
  1175. *** 647,652 ****
  1176. --- 657,671 ----
  1177.       case T_UNSPEC:
  1178.           return("UNSPEC");
  1179.   #endif /* ALLOW_T_UNSPEC */
  1180. + #ifdef SHUFFLE_ADDRS
  1181. +     /*
  1182. +      *  This is only used by named-xfer, and only in the case where
  1183. +      *  the -s flag is in use on the master server (and so SA records 
  1184. +      *  are sent rather than A records).
  1185. +      */
  1186. +     case T_SA:        /* shuffle address */
  1187. +         return("SA");
  1188. + #endif
  1189.       default:
  1190.           (void)sprintf(nbuf, "%d", type);
  1191.           return(nbuf);
  1192. diff -c -r bind4.9.orig/res/res_query.c bind4.9/res/res_query.c
  1193. *** bind4.9.orig/res/res_query.c    Sun May  2 19:58:19 1993
  1194. --- bind4.9/res/res_query.c    Fri May 21 14:22:08 1993
  1195. ***************
  1196. *** 182,187 ****
  1197. --- 182,198 ----
  1198.       if (n == 0 && (cp = __hostalias(name)))
  1199.           return (res_query(cp, class, type, answer, anslen));
  1200.   
  1201. + #ifdef TRY_AS_IS
  1202. +     /*
  1203. +      *      If there is more than one dot in the name already,
  1204. +      *    let's just give it a try 'as is'.
  1205. +      */
  1206. +     if (n > 1) {
  1207. +         if ((ret = res_query(name, class, type, answer, anslen)) > 0)
  1208. +             return(ret);
  1209. +     }
  1210. + #endif
  1211.       /*
  1212.        * We do at least one level of search if
  1213.        *    - there is no dot and RES_DEFNAME is set, or
  1214. Common subdirectories: bind4.9.orig/tools/nslookup and bind4.9/tools/nslookup
  1215.